﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/*
修复
 */
public class RecoveryDevice : Weapon {
	private float recoverHP = 3;//恢复血量
	private GameObject target;//保护的目标

	private bool overforTarget = false;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		if (target != null && !overforTarget)
		{
			switch (target.name)
			{
				case "Hero":
					target.GetComponent<PlayerController>().SetRecoverHp(recoverHP);
				break;
				case "smallEnemyPlane(Clone)":
					target.GetComponent<SmallEnemyPlane>().SetRecoverHp(recoverHP);
				break;
				case "middleEnemyPlane(Clone)":
					target.GetComponent<MiddleEnemyPlane>().SetRecoverHp(recoverHP);
				break;
				case "bigEnemyPlane(Clone)":
					target.GetComponent<BigEnemyPlane>().SetRecoverHp(recoverHP);
				break;
			}
			overforTarget = true;	
		}
		
	}

	public void SetTarget(GameObject target)
	{
		this.target = target;
	}
}
